package ink.xiaobaibai.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import ink.xiaobaibai.entity.OxygenDevice;
import ink.xiaobaibai.vo.UserByDeviceVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author xiaobaibai
 * @since 2021-05-22
 */
public interface OxygenDeviceDao extends BaseMapper<OxygenDevice> {

    public Integer getOxygenDeviceCount(@Param("userIdList") List<Integer> userId, @Param("status") String status, @Param("provinceCity") String provinceCity);

    public List<OxygenDevice> getOxygenDeviceList(@Param("limitStart") Integer limitStart, @Param("limitEnd") Integer limitEnd, @Param("userIdList") List<Integer> userId, @Param("status") String status, @Param("provinceCity") String provinceCity);

    @Select("SELECT u.id AS user_id,u.user_name,u.user_number,u.department_id,u.user_phone,d.department_name FROM admin_user u LEFT JOIN department d ON u.`department_id`=d.`id` WHERE u.id=#{userId}")
    public UserByDeviceVo getUserInfoByUserId(@Param("userId") Integer userId);

}
